<?php
class User extends MY_Controller{
	//获取token
	function update_user_info(){
		$data = $this->user_post_data;
		$user_id = $data['user_token']['user_id'];
		unset($data['user_token']);
		if(!empty($data['head_img_url'])){
			$data['head_img_url'] = get_qiniu_url($data['head_img_url']);
		}
		$this->db->update("users", $data, array("id" => $user_id));
		if($this->db->affected_rows() > 0){
			echo json_encode(array("code" => 1, "msg" => '资料修改成功'));
		}else{
			echo json_encode(array("code" => 0, "user" => '资料修改失败，请重试'));
		}
	}
}